package com.suineg.pms.commons.wabacus;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.suineg.pms.commons.AppConfig;
import com.suineg.pms.repository.base.CompanyDao;

/**
 * wabacus的服务器验证类
 *@author Suine
 */
public class Validate {
	/** 日志输出对象 */
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	
	/**
	 * 判断物业公司名是否重复
	 * @param name
	 * @return
	 */
	public static boolean isCompanyName(String name){
		System.out.println("跑没呢？？");
		if(name == null || name.isEmpty()){
			return true;
		}
		WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(AppConfig.getInstance().getApplication());
		CompanyDao companyDao = (CompanyDao)wac.getBean("companyDao");
		System.out.println(companyDao.toString());
		return false;
	}

}

